//
//  LMContentTableViewCell.m
//  LMLabelSelect
//
//  Created by xielei on 2022/12/5.
//

#import "LMContentTableViewCell.h"

@interface LMContentTableViewCell()
@property (strong,nonatomic) UILabel *label;
@end

@implementation LMContentTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


+ (NSString*)reuseIdentifier{
    return NSStringFromClass([LMContentTableViewCell class]);
}

- (void)setModel:(id<LMViewModelProtocol>)viewModel Index:(NSInteger)index{
    [self setUI];
    LMContentTableViewCellModel *cellModel = viewModel;
    LMTableViewCellItemsModel *model =  cellModel.model.items[index];
    self.label.text = [NSString stringWithFormat:@"%@、%@",model.name,model.content];
}

- (void)setUI{
    [self.contentView addSubview:self.label];
}

- (UILabel*)label{
    if (!_label){
        _label = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, KSCREENW, 60)];
        [self.contentView addSubview:_label];
    }
    return _label;
}

@end


@implementation LMContentTableViewCellModel

- (CGFloat)viewHeight{
    return self.height;
}

- (Class)viewClass{
    return [LMContentTableViewCell class];
}

- (void)setModel:(LMTableViewCellModel *)model{
    _model = model;
    
    self.height = 60;
}
@end
